/**
 * \file  plugin_admin.cpp
 * \brief implementation of PluginAdmin class.
 *
 * ASO: Antiviral Sequence Optimizer
 * <http://aso.googlecode.com/>
 * Copyright (C) 2010 Velez Ezequiel, Peralta Andres, FuDePAN
 *
 * This file is part of the ASO project.
 *
 * Contents:      CPP file for ASO providing class PluginAdmin.
 *
 * System:         ASO
 * Language:       C++
 *
 * Author:         Velez Ezequiel, Peralta Andres
 * E-Mail:
 *
 * ASO is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ASO is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ASO.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <unplugged/framework.h>
#include "aso-core/plugin_admin.h"

void PluginAdmin::load_plugin(const FileName& file) throw(PluginError)
{
    try
    {
        plg = Unplugged::load_plugin<Plugin>(file);
    }
    catch (const Unplugged::UnpluggedException& e)
    {
        throw PluginError(e.what());
    }
}

void PluginAdmin::unload_plugin()
{
    if (plg != NULL)
        plg->unload();
}


/* Pre: ait esta posicionado en el primer elemento.
        rejectedAntivirals esta vacio.
*/
bool PluginAdmin::check_plugin(AVIterator aIt, AntiviralsNames& rejectedAntivirals)
{
    return plg->accepts_db(aIt, rejectedAntivirals);
}


